home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 September / GSSH0904CD1.iso / RiseofNations / RedFront / RedFront.exe / Red Front / Red Front - 05 - Tankograd.bhs < prev    next >
Text File  |  2004-01-21  |  13KB  |  412 lines

  1. /* Red Front
  2.    Tankograd
  3.    
  4.    These events will control the Trankograd scenario for the Red Front campaign.
  5.   
  6.    Campaign By: Kevin 'DarthVeda' Chulski
  7.    Contact: darthveda@hotmail.com
  8.    Please email any questions/suggestions/comments that you have!   
  9. */
  10.  
  11. scenario
  12. {
  13.  
  14.   set_nation_name("Russians", $S("Red Army"));
  15.   
  16.   // initialize variables
  17.   
  18.   static wonder_choice = 0;
  19.   static int month = 12;
  20.   static int day = 1;
  21.   static int facMsg = 0;
  22.   int rallyID = 0;
  23.   
  24.   // goals
  25.   static int TAN_PRODUCTION_GOAL = 200;
  26.   static int KAT_PRODUCTION_GOAL = 25;
  27.   static int TANKS_PRODUCED = 0;
  28.   static int KATYUSHAS_PRODUCED = 0;
  29.   
  30.   
  31. labels {
  32.   //Add any constant labels here in a comma separated list.
  33.   
  34. }
  35.  
  36. run_once {
  37.   //Insert commands that should be executed only once when the script is loaded here.
  38.   
  39.   //disable weird things
  40.   
  41.   disable_type("Helicopter");
  42.   disable_type("Nuclear Missile");
  43.   disable_type("Missile Silo");
  44.   disable_type("Spy");
  45.   
  46.   // disable wonders
  47.   
  48.   disable_type( "Pyramids" );
  49.   disable_type( "Colossus" );
  50.   disable_type( "Terra Cotta Army" );
  51.   disable_type( "Colosseum" );
  52.   disable_type( "Temple of Tikal" );
  53.   disable_type( "Porcelain Tower" );
  54.   disable_type( "Angkor Wat" );
  55.   disable_type( "Versailles" );
  56.   disable_type( "Statue of Liberty" );
  57.   disable_type( "Kremlin" );
  58.   disable_type( "Taj Mahal" );
  59.   disable_type( "Eiffel Tower" );
  60.   disable_type( "Supercollider" );
  61.   disable_type( "Space Program" );
  62.   
  63.   // disable certain buildings and guys
  64.   
  65.   disable_type( "Fishermen" );
  66.   disable_type( "Supply Wagon" );
  67.   
  68.   // disable ships
  69.   
  70.   disable_type("Submarine");
  71.   disable_type("Dreadnought");
  72.   disable_type("Destroyer");
  73.   
  74.   //Gain Upgrades 
  75.   
  76.   // disable upgrades 
  77.   
  78.   // set timers
  79.   set_timer( "cdar", 60 );
  80.   set_timer( "sibir", 60 );
  81.   set_timer( "factory", 45 );
  82.     
  83.   // disable triggers
  84.   
  85.   disable_trigger( "oilers" );
  86.   disable_trigger( "metalman" );
  87.   
  88.   // blurb or cinematic
  89.   
  90.     
  91. }
  92.  
  93. //Main script body.
  94. //Add triggers and other commands to be executed each game frame here.
  95. //Use Edit->Insert Trigger Function to select from the list of available functions
  96. //Use Edit->Insert Trigger Block to add a blank trigger block.
  97. //See ./scenario/sample_script.bhs for additional documentation
  98.  
  99.   trigger opening_scene ( )
  100.   {
  101.     set_msg_time(20);//Sets message time to 30 seconds
  102.     scrolling_lock();//Locks scrolling
  103.     zooming_lock();//Locks zooming
  104.     hotkey_selection_disable();//disables hotkey selection
  105.     ui_hide();//Hides the UI
  106.     mouse_selection_disable();//disables mouse selection
  107.     print_msg( "During 1941, over 10 million civilians and hundreds of major industries were evacuated East to the Urals.  Chelyabinsk, or \"Tankograd\" as it was nicknamed, became the premier site for tank construction in the Soviet Union during the war." ); 
  108.   }
  109.   
  110.   trigger build_first_factory ( object_near( 1, 4, 231, 20, 3) )
  111.   {
  112.     kill_unit_anim( 1, 4, 1);
  113.     create_building( 1, 231, 20, "Factory");
  114.   }
  115.   
  116.   trigger opening_dialog ( !is_trigger_enabled( "build_first_factory" ) )
  117.   {
  118.     move_camera(231,20); //Moves camera from action scene
  119.     set_msg_time(6); //Resets message time to default
  120.     clear_msg(); //clears text
  121.     scrolling_unlock();
  122.     zooming_unlock();
  123.     hotkey_selection_enable();
  124.     mouse_selection_enable();
  125.     ui_show();
  126.     add_objective_text( "Date: December 1, 1941", "date", "null.wav" );
  127.     popup_dialog( "Greetings comrade general.  You have been brought to the Urals to help our wartime production efforts.  The effort here will be production and city construction; not combat.  You are to complete the following by the end of the year:" );
  128.     popup_dialog( "NEW OBJECTIVE: Produce " + TAN_PRODUCTION_GOAL + " Tanks." );
  129.     add_objective( "Produce " + TAN_PRODUCTION_GOAL + " Tanks", "gtanks", "null.wav" );
  130.     add_objective_text( TANKS_PRODUCED + " Tanks produced", "tav", "null.wav" );
  131.     popup_dialog( "NEW OBJECTIVE: Produce " + KAT_PRODUCTION_GOAL + " Katyushas." );
  132.     add_objective( "Produce " + KAT_PRODUCTION_GOAL + " Katyushas", "gkatyushas", "null.wav" );
  133.     add_objective_text( KATYUSHAS_PRODUCED + " Katyushas produced", "kav", "null.wav" );
  134.     popup_dialog( "In addition, your unique talents have provided us a special (selectable) bonus: ");
  135.     while ( wonder_choice == 0 )
  136.     {
  137.       if ( popup_choice( "OPTION A: You are a Communist party member and your influence keeps prices flat, scientists motivated, and keeps religion at bay", "Yeah that's me", "No, but..." ) == 1 )
  138.       {
  139.         wonder_choice = 1;
  140.       }
  141.       else if ( popup_choice( "OPTION B: You are skilled with the production of oil.", "I bathe in the stuff", "Well not really..." ) == 1 )
  142.       {
  143.         wonder_choice = 2;
  144.       }
  145.       else if ( popup_choice( "OPTION C: You are an accomplished construction manager.", "Make it so", "Not so quick..." ) == 1 )
  146.       {
  147.         wonder_choice = 3;
  148.       }
  149.       else if ( popup_choice( "OPTION D: Metal working and streamlined production are your forte.", "I'm made of Iron", "Let's go back..." ) == 1 )
  150.       {
  151.         wonder_choice = 4;
  152.       }
  153.     }
  154.     if ( wonder_choice == 1 )
  155.     {
  156.       create_building( 1, 257, 42, "Supercollider" );
  157.       disable_type( "Temple" );
  158.     }
  159.     else if ( wonder_choice == 2 )
  160.     {
  161.       create_building( 1, 257, 42, "Eiffel Tower" );
  162.       enable_trigger( "oilers" );
  163.       set_timer( "oilMe", 1 );
  164.     }
  165.     else if ( wonder_choice == 3 )
  166.     {
  167.       create_building( 1, 257, 42, "Versailles" );
  168.       gain_tech( 1, "Construction" );
  169.       gain_tech( 1, "Architecture" );
  170.       gain_tech( 1, "Engineering" );
  171.     }
  172.     else
  173.     {
  174.       create_building( 1, 257, 42, "Angkor Wat" );
  175.       enable_trigger( "metalman" );
  176.       set_timer( "metalMe", 1 );
  177.       set_type_build_time( "Medium Tank", 20000);
  178.       set_type_build_time( "Katyusha Rocket", 20000);
  179.     }
  180.     
  181.     popup_dialog( "Comrade general, you have until the end of December to complete your goals.  Remember that for a unit to be considered \"produced\" it must be moved to the rally point on the map." );
  182.     move_camera( 12, 269 );
  183.     add_flag( 12, 269 );
  184.     ping( 1, 1, 12, 269 );
  185.   }
  186.   
  187.   trigger oilers ( timer_expired( "oilMe" ) )
  188.   {
  189.     give_good( 1, "oil", 100);
  190.     set_timer( "oilMe", 60 );
  191.     enable_trigger( "oilers" );
  192.   }
  193.   
  194.   trigger metalman ( timer_expired( "metalMe" ) )
  195.   {
  196.     give_good( 1, "metal", 75);
  197.     set_timer( "metalMe", 60 );
  198.     enable_trigger( "metalman" );
  199.   }
  200.   
  201.   trigger rallied ( object_type_near(1,"Medium Tank",1,12,269,10) )
  202.   {
  203.     rallyID = 0;
  204.  
  205.     rallyID = find_unit( 1, "Medium Tank" );
  206.     for( int i = 0; i <= num_type( 1, "Medium Tank" ); i++ ) 
  207.     {
  208.       if( object_near( 1, rallyID, 12,269, 10 ) ) 
  209.       {
  210.         kill_unit_anim(1,rallyID,1);
  211.         TANKS_PRODUCED++;
  212.         break;
  213.       }
  214.     }
  215.     
  216.     change_objective_text( "tav", TANKS_PRODUCED + " Tanks produced" );
  217.     
  218.     enable_trigger( "rallied" );
  219.     
  220.   }
  221.   
  222.   
  223.   trigger rallied2 ( object_type_near(1,"Katyusha Rocket",1,12,269,10) )
  224.   {
  225.     rallyID = 0;
  226.  
  227.     rallyID = find_unit( 1, "Katyusha Rocket" );
  228.     for( int j = 0; j <= num_type( 1, "Katyusha Rocket" ); j++ ) 
  229.     {
  230.       if( object_near( 1, rallyID, 12,269, 10 ) ) 
  231.       {
  232.         kill_unit_anim(1,rallyID,1);
  233.         KATYUSHAS_PRODUCED++;
  234.         break;
  235.       }
  236.     }
  237.         
  238.     change_objective_text( "kav", KATYUSHAS_PRODUCED + " Katyushas produced" );
  239.        
  240.     enable_trigger( "rallied2" );
  241.     
  242.   }
  243.   
  244.   trigger calendar ( timer_expired( "cdar" ) )
  245.   {  
  246.     // check for month change
  247.     if ( day == 31 && month == 12 )
  248.     {
  249.       // its the end of the scenario
  250.       popup_dialog( "General, your efforts would make even a quartermaster weep.  Without sufficient armor, our troops on the front will have a hard time fighting against a much better equipped enemy.  You have been dismissed." );
  251.       defeat( 1 );
  252.     }
  253.     else
  254.     {
  255.       // no month change, normal increment
  256.       day++;
  257.     }
  258.     
  259.     change_objective_text( "date", "Date: December " +day+", 1941" );
  260.     
  261.     // also update the daily production
  262.        
  263.     set_timer( "cdar", 60 );
  264.     enable_trigger( "calendar" );
  265.   } // end of calendar trigger
  266.   
  267.   trigger end_o_sibir ( month == 12 && day == 14 )
  268.   {
  269.     disable_trigger( "siberia" );
  270.   }
  271.   
  272.   trigger end_o_fac ( month == 12 && day == 11 )
  273.   {
  274.     popup_dialog( "The last of the factories has arrived from the west." );
  275.     disable_trigger( "fac" );
  276.   }
  277.   
  278.   trigger end_o_crushination ( month == 12 && day == 18 )
  279.   {
  280.     // stops AI units from being destroyed
  281.     disable_trigger( "move_off_map" );
  282.   }
  283.   
  284.   trigger fac ( timer_expired( "factory" ) )
  285.   {
  286.     
  287.     create_unit( 1, 12, 269, "Supply Wagon", 1 );
  288.     create_unit( 1, 12, 269, "Citizen", 2 );
  289.     ping( 1, 1, 12, 269 );
  290.     if ( !facMsg )
  291.     {
  292.       move_camera( 12, 269 );
  293.       popup_dialog( "Comrade general, the first factories from the west are now arriving.  Select them and move them to where you would like.  When you have found a suitable location, deploy the factory by pressing the 'D' key." );
  294.       facMsg = 1;
  295.     }
  296.     set_timer( "factory", 60 );
  297.     enable_trigger( "fac" );
  298.     
  299.   }
  300.   
  301.   trigger factories_build ( key_down( "d" ) && object_type_selected( 1, "Supply Wagon") )
  302.   {
  303.     int selectedID = find_selected_id( 1 );
  304.     int selectedX = object_position_x( 1, selectedID );
  305.     int selectedY = object_position_y( 1, selectedID );
  306.     
  307.     int type_selection = popup_choice( "What type of factory will we construct?", "An Auto Plant", "A Factory" );
  308.     
  309.     if ( type_selection )
  310.     {
  311.       if ( create_building( 1, selectedX, selectedY, "Auto Plant" ) != -1 )
  312.       {
  313.         kill_unit_anim( 1, selectedID, 1 );
  314.       }
  315.       else
  316.       {
  317.         print_game_msg( "Error: Cannot deploy factory here" );
  318.       }
  319.     }
  320.     else
  321.     {
  322.       if ( create_building( 1, selectedX, selectedY, "Factory" ) != -1 )
  323.       {
  324.         kill_unit_anim( 1, selectedID, 1 );
  325.       }
  326.       else
  327.       {
  328.         print_game_msg( "Error: Cannot deploy factory here" );
  329.       }
  330.     }
  331.     
  332.     enable_trigger( "factories_build" );
  333.   }
  334.   
  335.   trigger siberia ( timer_expired( "sibir" ) )
  336.   {
  337.     create_unit(2,175,7,"Shock Infantry",3);
  338.     group_move_order(2,12,269);
  339.     create_unit(2,175,7,"Heavy Machine Gun",1);
  340.     group_move_order(2,12,269);
  341.     create_unit(2,175,7,"Tank",1);
  342.     group_move_order(2,12,269);
  343.     
  344.     enable_trigger( "siberia" );
  345.     set_timer( "sibir", 60 );
  346.   }
  347.   
  348.   trigger move_off_map ( object_type_near(2, "Medium Tank",1,12,269,15) || object_type_near(2,"Heavy Machine Gun",1,12,269,10) || object_type_near(2,"Shock Infantry",1,12,269,10) )
  349.   {
  350.     int rallyID2;
  351.  
  352.     if ( object_type_near(2,"Medium Tank",1,12,269,15) )
  353.     { 
  354.       rallyID2 = find_unit( 2, "Medium Tank" ); 
  355.       for( int l = 0; l <= num_type( 2, "Medium Tank" ); l++ ) 
  356.       {
  357.         if( object_near( 2, rallyID2, 12,269, 15 ) ) 
  358.         {
  359.           kill_unit_anim( 2, rallyID2, 1 );
  360.           break;
  361.         }
  362.       }
  363.     }
  364.     else if ( object_type_near( 2, "Heavy Machine Gun", 1, 12, 269, 10 ) )
  365.     {  
  366.       rallyID2 = find_unit( 2, "Heavy Machine Gun" );
  367.       for( int m = 0; m <= num_type( 2, "Heavy Machine Gun" ); m++ ) 
  368.       {
  369.         if( object_near( 2, rallyID2, 12,269, 10 ) ) 
  370.         {
  371.           kill_unit_anim(2, rallyID2, 1);
  372.           break;
  373.         }
  374.       }
  375.     }
  376.     else if ( object_type_near( 2, "Shock Infantry", 1, 12, 269, 10) )
  377.     {  
  378.       
  379.       rallyID2 = find_unit( 2,  "Shock Infantry" );
  380.       for( int n = 0; n <= num_type( 2,  "Shock Infantry" ); n++ ) 
  381.       {
  382.         if( object_near( 2, rallyID2, 12, 269, 10 ) ) 
  383.         {
  384.           kill_unit_anim( 2, rallyID2, 1);
  385.           break;
  386.         }
  387.       }
  388.     }
  389.        
  390.     enable_trigger( "move_off_map" );          
  391.   }
  392.   
  393.   trigger tank_rally ( TANKS_PRODUCED >= TAN_PRODUCTION_GOAL )
  394.   {
  395.     objective_complete( "gtanks" );
  396.     objective_complete( "tav" );
  397.   }
  398.   
  399.   trigger kat_rally ( KATYUSHAS_PRODUCED >= KAT_PRODUCTION_GOAL )
  400.   {
  401.     objective_complete( "gkatyushas" );
  402.     objective_complete( "kav" );
  403.   }
  404.   
  405.   trigger you_win ( !is_trigger_enabled( "tank_rally" ) && !is_trigger_enabled( "kat_rally" ) )
  406.   {
  407.     popup_dialog( "Good work comrade general.  Our winter offensive and spring campaign will be well supplied with the armor of war thanks to your efforts." );
  408.     popup_dialog( "You are now ready for the sixth part of this campaign.  Please load the next scenario in the Red Front sequence." );
  409.     victory( 1 );
  410.   }
  411.  
  412. }